﻿
fs.util.pageLoadFunction.push(function () {
    fs.sys.defaultDigits = 4;
});

firstColumns = [
  { index: 1, headerText: "Local Currency", edit: false, width: 80, rowText: "LC", manual: true },
  { index: 2, headerText: "Foreign Currency", edit: false, width: 80, rowText: "FC", manual: true },
  { index: 3, headerText: "YTD-M", edit: true, width: 80, rowText: "YTD" },
  { index: 4, headerText: "M+1", edit: true, width: 80, rowText: "M_1" },
  { index: 5, headerText: "M+2", edit: true, width: 80, rowText: "M_2" },
  { index: 6, headerText: "M+3", edit: true, width: 80, rowText: "M_3" },
  { index: 7, headerText: "YTD-M+1", edit: true, width: 80, rowText: "YTDM_1" },
  { index: 8, headerText: "YTD-M+2", edit: true, width: 80, rowText: "YTDM_2" },
  { index: 9, headerText: "YTD-M+3", edit: true, width: 80, rowText: "YTDM_3" },
  { index: 10, headerText: "Full year forecast", edit: true, width: 80, rowText: "FCST" }
];

//  var afterSearchBinding = function (items) {
//      $(items).each(function () {
//          var row = this;

//          if (fs.form.mode == "New")
//              row["FCST"](unWarpValue(row["YTDM_3"])); 
//      }); 
//  }

var readyJSON = [
{ accountcode: "ER04000001", LC: "EUR", FC: "USD", datarow: true, Process: [{
    Field: "YTD",
    Exp: {
        mode: "refrence", list: "Common_Exchange_Rate_Actual", fields: ["YTD|ER01000001"], equ: "+"
    }
}, {
    Field: "YTDM_1",
    Exp: {
        mode: "search", fields: ["YTD|ER04000001", "M_1|ER04000001"], equ: "(function(){  if(_CM_ ==12){return ({1});}  else{ return ((({0})*_CM_)+({1}))/(_CM_+1); }})()", equexpression: true
    }
}, {
    Field: "YTDM_2",
    Exp: {
        mode: "search", fields: ["YTD|ER04000001", "M_1|ER04000001", "M_2|ER04000001"], equ: "(function(){if(_CM_ == 11){ return ({2}); }else if(_CM_ == 12){ return (({1})+({2}))/2; }else{ return ((({0})*_CM_)+({1})+({2}))/(_CM_+2); }})()", equexpression: true
    }
}, {
    Field: "YTDM_3",
    Exp: {
        mode: "search", fields: ["YTD|ER04000001", "M_1|ER04000001", "M_2|ER04000001", "M_3|ER04000001"], equ: "(function(){if(_CM_ == 10){ return ({3}); } else if(_CM_ == 11){ return (({2})+({3}))/2; }else if(_CM_ == 12){ return (({1})+({2})+({3}))/3; }else{ return ((({0})*_CM_)+({1})+({2})+({3}))/(_CM_+3); }})()", equexpression: true
    }
}]
},
{ accountcode: "ER04000002", LC: "EUR", FC: "RMB", datarow: true, Process: [{
    Field: "YTD",
    Exp: {
        mode: "refrence", list: "Common_Exchange_Rate_Actual", fields: ["YTD|ER01000002"], equ: "+"
    }
}, {
    Field: "YTDM_1",
    Exp: {
        mode: "search", fields: ["YTD|ER04000002", "M_1|ER04000002"], equ: "(function(){  if(_CM_ ==12){return ({1});}  else{ return ((({0})*_CM_)+({1}))/(_CM_+1); }})()", equexpression: true
    }
}, {
    Field: "YTDM_2",
    Exp: {
        mode: "search", fields: ["YTD|ER04000002", "M_1|ER04000002", "M_2|ER04000002"], equ: "(function(){if(_CM_ == 11){ return ({2}); }else if(_CM_ == 12){ return (({1})+({2}))/2; }else{ return ((({0})*_CM_)+({1})+({2}))/(_CM_+2); }})()", equexpression: true
    }
}, {
    Field: "YTDM_3",
    Exp: {
        mode: "search", fields: ["YTD|ER04000002", "M_1|ER04000002", "M_2|ER04000002", "M_3|ER04000002"], equ: "(function(){if(_CM_ == 10){ return ({3}); } else if(_CM_ == 11){ return (({2})+({3}))/2; }else if(_CM_ == 12){ return (({1})+({2})+({3}))/3; }else{ return ((({0})*_CM_)+({1})+({2})+({3}))/(_CM_+3); }})()", equexpression: true
    }
}]
},
{ accountcode: "ER04000003", LC: "EUR", FC: "SGD", datarow: true, Process: [{
    Field: "YTD",
    Exp: {
        mode: "refrence", list: "Common_Exchange_Rate_Actual", fields: ["YTD|ER01000003"], equ: "+"
    }
}, {
    Field: "YTDM_1",
    Exp: {
        mode: "search", fields: ["YTD|ER04000003", "M_1|ER04000003"], equ: "(function(){  if(_CM_ ==12){return ({1});}  else{ return ((({0})*_CM_)+({1}))/(_CM_+1); }})()", equexpression: true
    }
}, {
    Field: "YTDM_2",
    Exp: {
        mode: "search", fields: ["YTD|ER04000003", "M_1|ER04000003", "M_2|ER04000003"], equ: "(function(){if(_CM_ == 11){ return ({2}); }else if(_CM_ == 12){ return (({1})+({2}))/2; }else{ return ((({0})*_CM_)+({1})+({2}))/(_CM_+2); }})()", equexpression: true
    }
}, {
    Field: "YTDM_3",
    Exp: {
        mode: "search", fields: ["YTD|ER04000003", "M_1|ER04000003", "M_2|ER04000003", "M_3|ER04000003"], equ: "(function(){if(_CM_ == 10){ return ({3}); } else if(_CM_ == 11){ return (({2})+({3}))/2; }else if(_CM_ == 12){ return (({1})+({2})+({3}))/3; }else{ return ((({0})*_CM_)+({1})+({2})+({3}))/(_CM_+3); }})()", equexpression: true
    }
}]
},
{ accountcode: "ER04000004", LC: "EUR", FC: "JPY", datarow: true, Process: [{
    Field: "YTD",
    Exp: {
        mode: "refrence", list: "Common_Exchange_Rate_Actual", fields: ["YTD|ER01000004"], equ: "+"
    }
}, {
    Field: "YTDM_1",
    Exp: {
        mode: "search", fields: ["YTD|ER04000004", "M_1|ER04000004"], equ: "(function(){  if(_CM_ ==12){return ({1});}  else{ return ((({0})*_CM_)+({1}))/(_CM_+1); }})()", equexpression: true
    }
}, {
    Field: "YTDM_2",
    Exp: {
        mode: "search", fields: ["YTD|ER04000004", "M_1|ER04000004", "M_2|ER04000004"], equ: "(function(){if(_CM_ == 11){ return ({2}); }else if(_CM_ == 12){ return (({1})+({2}))/2; }else{ return ((({0})*_CM_)+({1})+({2}))/(_CM_+2); }})()", equexpression: true
    }
}, {
    Field: "YTDM_3",
    Exp: {
        mode: "search", fields: ["YTD|ER04000004", "M_1|ER04000004", "M_2|ER04000004", "M_3|ER04000004"], equ: "(function(){if(_CM_ == 10){ return ({3}); } else if(_CM_ == 11){ return (({2})+({3}))/2; }else if(_CM_ == 12){ return (({1})+({2})+({3}))/3; }else{ return ((({0})*_CM_)+({1})+({2})+({3}))/(_CM_+3); }})()", equexpression: true
    }
}]
},
{ accountcode: "ER04000005", LC: "EUR", FC: "KRW", datarow: true, Process: [{
    Field: "YTD",
    Exp: {
        mode: "refrence", list: "Common_Exchange_Rate_Actual", fields: ["YTD|ER01000005"], equ: "+"
    }
}, {
    Field: "YTDM_1",
    Exp: {
        mode: "search", fields: ["YTD|ER04000005", "M_1|ER04000005"], equ: "(function(){  if(_CM_ ==12){return ({1});}  else{ return ((({0})*_CM_)+({1}))/(_CM_+1); }})()", equexpression: true
    }
}, {
    Field: "YTDM_2",
    Exp: {
        mode: "search", fields: ["YTD|ER04000005", "M_1|ER04000005", "M_2|ER04000005"], equ: "(function(){if(_CM_ == 11){ return ({2}); }else if(_CM_ == 12){ return (({1})+({2}))/2; }else{ return ((({0})*_CM_)+({1})+({2}))/(_CM_+2); }})()", equexpression: true
    }
}, {
    Field: "YTDM_3",
    Exp: {
        mode: "search", fields: ["YTD|ER04000005", "M_1|ER04000005", "M_2|ER04000005", "M_3|ER04000005"], equ: "(function(){if(_CM_ == 10){ return ({3}); } else if(_CM_ == 11){ return (({2})+({3}))/2; }else if(_CM_ == 12){ return (({1})+({2})+({3}))/3; }else{ return ((({0})*_CM_)+({1})+({2})+({3}))/(_CM_+3); }})()", equexpression: true
    }
}]
}

]